﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Tasks;
namespace MyUtility
{
    public partial class PhoneCallPage : PhoneApplicationPage
    {
        public PhoneCallPage()
        {
            InitializeComponent();
        }

        private void bntCallTo_Click(object sender, System.Windows.RoutedEventArgs e)
        {
        	// TODO: Add event handler implementation here.
			PhoneCallTask call = new PhoneCallTask();
			call.PhoneNumber = txtPhoneNumber.Text;
			call.DisplayName = "";
			call.Show();
        }

        private void bntPhoneNumber_Click(object sender, System.Windows.RoutedEventArgs e)
        {
        	// TODO: Add event handler implementation here.
			PhoneNumberChooserTask number = new PhoneNumberChooserTask();
			number.Completed +=new System.EventHandler<Microsoft.Phone.Tasks.PhoneNumberResult>(number_Completed);
       		number.Show();
		}

        private void number_Completed(object sender, Microsoft.Phone.Tasks.PhoneNumberResult e)
        {
        	// TODO: Add event handler implementation here.
			if(e.TaskResult == TaskResult.OK){
				txtPhoneNumber.Text = e.PhoneNumber;
			}
        }
    }
}
